package biz.obake.team.touchprotector.d.h;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import biz.obake.team.touchprotector.g.c;
import java.util.Map;

public class b implements biz.obake.team.touchprotector.d.a {

    /* renamed from: b  reason: collision with root package name */
    private BroadcastReceiver f1577b = new a(this);

    class a extends BroadcastReceiver {
        a(b bVar) {
        }

        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action != null) {
                char c2 = 65535;
                int hashCode = action.hashCode();
                if (hashCode != -1886648615) {
                    if (hashCode == 1019184907 && action.equals("android.intent.action.ACTION_POWER_CONNECTED")) {
                        c2 = 0;
                    }
                } else if (action.equals("android.intent.action.ACTION_POWER_DISCONNECTED")) {
                    c2 = 1;
                }
                if (c2 == 0) {
                    biz.obake.team.touchprotector.log.a.b().d("Power: Connected");
                    c.f("Power.Connected", true);
                } else if (c2 == 1) {
                    biz.obake.team.touchprotector.log.a.b().d("Power: Disconnected");
                    c.f("Power.Connected", false);
                }
            }
        }
    }

    public static boolean a() {
        return c.b("Power.Connected");
    }

    public static void b(Map<String, String> map) {
        map.put("Power.Connected", biz.obake.team.touchprotector.c.q() ? "true" : "false");
    }

    private void c() {
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.ACTION_POWER_CONNECTED");
        intentFilter.addAction("android.intent.action.ACTION_POWER_DISCONNECTED");
        biz.obake.team.android.a.a().registerReceiver(this.f1577b, intentFilter);
    }

    private void d() {
        biz.obake.team.android.a.a().unregisterReceiver(this.f1577b);
    }

    public void start() {
        c();
    }

    public void stop() {
        d();
    }
}
